﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AnimationEditor
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
            splitContainer.Panel2.MouseWheel += new MouseEventHandler(Panel2_MouseWheel);
            frameViewControl.MouseWheel += new MouseEventHandler(frameViewControl_MouseWheel);
            MouseWheel += new MouseEventHandler(MainForm_MouseWheel);
        }

        void MainForm_MouseWheel(object sender, MouseEventArgs e)
        {
            frameViewControl_MouseWheel(sender, e);
        }

        void Panel2_MouseWheel(object sender, MouseEventArgs e)
        {
            frameViewControl_MouseWheel(sender, e);
        }

        void frameViewControl_MouseWheel(object sender, MouseEventArgs e)
        {
            if (frameViewControl.Image != null && Control.ModifierKeys == Keys.Control)
            {
                frameViewControl.ScaleFactor += e.Delta * SystemInformation.MouseWheelScrollLines / 1200f;
                if (frameViewControl.ScaleFactor < 1f)
                    frameViewControl.ScaleFactor = 1f;
                frameViewControl.Width = (int)(frameViewControl.Image.Width * frameViewControl.ScaleFactor);
                frameViewControl.Height = (int)(frameViewControl.Image.Height * frameViewControl.ScaleFactor);
                frameViewControl.Invalidate();
            }
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
